home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / graphics / animationcreation / mactor11.lha / MainActor / rexx / Scale_adpro.ma < prev   
Encoding:
Text File  |  1993-06-18  |  3.5 KB  |  140 lines

  1. /*
  2.  *
  3.  *     Scale V 1.0, 1993 Markus Moenig
  4.  *
  5.  *     Scales the source project to a requested size, needs AdPro !!
  6.  *     The new project gets the name of the source project + ".new"
  7.  *     and is also converted to the saver module type of the source project.
  8.  *
  9.  *     The loader/saver of the source project can be either picture
  10.  *     or animation modules, if you have an animation saver, this script
  11.  *     opens a temporary project. This is needed to append the frames to
  12.  *     the destination project.
  13.  *
  14.  *     A new project will be opened for the resulting pictures/animation.
  15.  */
  16.  
  17. OPTIONS RESULTS
  18.  
  19. ADDRESS MAINACTOR 
  20.  
  21. ScreenToFront
  22. PrintAndStoreTXT "Scale V1.0, scaling project ..."
  23.  
  24. IF ~SHOW('P','ADPro') THEN DO  /* if not allready running, start adpro */
  25.     ADDRESS MAINACTOR PrintTXT "Invoking AdPro ..."
  26.     ADDRESS COMMAND 'run >NIL: <NIL: adpro:adpro BEHIND MAXMEM=1000000'
  27.     ADDRESS COMMAND Wait 5
  28. END  
  29.  
  30. ADDRESS MAINACTOR
  31.  
  32. GetSPName
  33.  
  34. IF rc = 0 THEN DO                          /* check if project loaded */
  35.  
  36.     PARSE VAR RESULT firstname secondname .  /* store name of the animation */
  37.                                              /* or the names of the picture list */
  38.     ScreenToFront
  39.  
  40.     DeSelectAll
  41.  
  42.     GetSPSaver
  43.     PARSE VAR RESULT savertype savername .   /* store type, name of saver module */
  44.  
  45.                                            /* Store general infos of the project */
  46.     GetSPInfo
  47.     PARSE VAR RESULT width height colors pics caching loop cpf .
  48.  
  49.     RequestInteger width "Enter new Width"
  50.     IF RC = 10 THEN DO
  51.         PrintTXT "Aborting ..."
  52.         EXIT
  53.     END
  54.     newxsize=RESULT
  55.  
  56.     RequestInteger height "Enter new Height"
  57.     IF RC = 10 THEN DO
  58.         PrintTXT "Aborting ..."
  59.         EXIT
  60.     END
  61.     newysize=RESULT
  62.     Scale=newxsize || " " || newysize
  63.  
  64.     IF savertype = "PIC" THEN
  65.         picformat=savername
  66.     ELSE DO
  67.         picformat=IFF
  68.         SetSPSaver PIC picformat
  69.     END
  70.     
  71.     ADDRESS "ADPro"
  72.         LFormat "Universal"
  73.         PSTATUS UNLOCKED
  74.         ORIENTATION PORTRAIT
  75.         SFormat picformat
  76.  
  77.     ADDRESS MAINACTOR
  78.  
  79.     newname = firstname || ".new"            /* new name = old one + ".new" */
  80.  
  81.     SelectAll
  82.     
  83.     saveargs=newname
  84.         
  85.     Save saveargs                            /* Save Pictures */
  86.  
  87.     DO i=1 to pics                           /* Scale all pics */
  88.  
  89.         actualpic=newname || "." || Right("00000" || i, 5)
  90.     PrintTxt "ADPro scales Picture" i
  91.  
  92.         ADDRESS "ADPro"    
  93.         Load actualpic
  94.         RENDER_TYPE colors
  95.         ABS_SCALE Scale
  96.         PSORT 0
  97.         Execute    
  98.         Save actualpic IMAGE
  99.  
  100.         ADDRESS MAINACTOR
  101.  
  102.     END
  103.  
  104.     IF caching = "CACHING=YES" THEN                 /* Was the old project cached ? */
  105.         
  106.         OpenNewProject "CACHING"               /* If yes new project is also cached */
  107.     
  108.     ELSE 
  109.         
  110.         OpenNewProject                         /* If not new project is not cached */
  111.  
  112.     SetSPLoader PIC picformat                /* Set the new projects loader module */
  113.  
  114.     firstpic=newname || "." || Right("00000" || 1, 5)
  115.     lastpic=newname || "." || Right("00000" || pics, 5)
  116.  
  117.     LoadProject firstpic lastpic             /* Load picture list */
  118.  
  119.     SetSPSaver savertype savername
  120.  
  121.     IF savertype = "ANIM" THEN DO            /* If we wanted a new animation, */
  122.                                              /* we have to build it */
  123.         SelectAll
  124.         saveargs=newname || " " || cpf || " " || loop
  125.         Save saveargs
  126.         UnloadProject
  127.         
  128.         DO i=1 TO pics                         /* delete temporary pics */
  129.             actualpic=newname || "." || Right("00000" || i, 5)
  130.             PrintTxt "Delete " || actualpic
  131.             ADDRESS COMMAND    "delete " || actualpic
  132.         END
  133.         
  134.         SetSPLoader savertype savername
  135.         LoadProject newname
  136.     END
  137.     
  138.     PrintAndStoreTXT "READY !!!!"
  139. END
  140.